package operation;

import book.Book;
import book.Booklist;

import java.util.Scanner;

public class Add implements IOperation{
    @Override
    public void work(Booklist booklist) {
//        IOperation.super.work(booklist);  //这是什么东西
        System.out.println("添加图书信息!");
        Scanner scan = new Scanner(System.in);
        System.out.print("请输入书名：");
        String name = scan.nextLine();
        System.out.print("请输入书本价格：");
        double price = scan.nextDouble();
        System.out.print("请输入书籍作者：");
        String author = scan.nextLine();

        booklist.setBook(booklist.getNum() + 1, new Book(name,price,author));
        booklist.setNum( booklist.getNum() + 1 );

        System.out.println("图书信息添加成功！");
    }
}
